package com.spring.mvc.mina.codec;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

public class PduCodecFactory implements ProtocolCodecFactory  {
	
	private final PduProtocolEncoder encoder;
	private final PduProtocolDecoder decoder;
	
	public PduCodecFactory() {
		this(Thread.currentThread().getClass().getClassLoader());
	}

	public PduCodecFactory(ClassLoader classLoader) {
		this.encoder=new PduProtocolEncoder();
		this.decoder=new PduProtocolDecoder();
	}

	public ProtocolDecoder getDecoder(IoSession session) throws Exception {
		return this.decoder;
	}

	public ProtocolEncoder getEncoder(IoSession session) throws Exception {
		return this.encoder;
	}

}
